package com.mock.action.organisation.directorate;

import java.util.ArrayList;
import java.util.List;

import com.mock.action.AbstractAction;
import com.mock.dao.OrganisationDao;
import com.mock.dao.impl.OrganisationDaoImpl;
import com.mock.model.Organisation;

public class GetOrganisationAddressToDirectorateAction extends AbstractAction{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5587125030962991758L;
	
	public String execute(){
		return SUCCESS;
	}
	
	private Long directorateId;
	private Long organisationId;
	private List<String> address = new ArrayList<String>();
	public String getAddressFromOrganisation(){
		//DirectorateDao directorateDao = new DirectorateDaoImp();
		OrganisationDao organisationDao = new OrganisationDaoImpl();
		try {
			//organisationId = directorateDao.getById(directorateId).getOrganisation().getOrganisationId();
			Organisation organisation = organisationDao.getById(organisationId);
			
			address = new ArrayList<String>();
			address.add(organisation.getAddressLine1());
			address.add(organisation.getAddressLine2());
			address.add(organisation.getAddressLine3());
			address.add(organisation.getPostcode());
			address.add(organisation.getCity());
			address.add(organisation.getCounty());
			address.add(organisation.getCountry().getCountryId()+"");
			
		} catch (Exception e) { 
			System.out.println("Error Id Directoreate : "+ e.getMessage());
		}		
		return SUCCESS;
	}
	// getter and setter

	/**
	 * @return the organisationId
	 */
	
	public Long getDirectorateId() {
		return directorateId;
	}

	public void setDirectorateId(Long directorateId) {
		this.directorateId = directorateId;
	}

	public List<String> getAddress() {
		return address;
	}

	public void setAddress(List<String> address) {
		this.address = address;
	}

	/**
	 * @return the organisationId
	 */
	public Long getOrganisationId() {
		return organisationId;
	}

	/**
	 * @param organisationId the organisationId to set
	 */
	public void setOrganisationId(Long organisationId) {
		this.organisationId = organisationId;
	}

	

	

	
	
	
}
